package com.smartticket.jeju.repository;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

import com.smartticket.jeju.model.Ticket;

@Component
@Qualifier("ticketRowMapper")
public class TicketRowMapper implements RowMapper<Ticket> 
{
	public Ticket mapRow(final ResultSet rs, final int rowNum) throws SQLException 
	{
		Ticket ticket = new Ticket();
		ticket.setId(rs.getInt("id"));
		ticket.setSight_id(rs.getInt("sight_id"));
		ticket.setGoal_count(rs.getInt("goal_count"));
		ticket.setDiscount_rate(rs.getFloat("discount_rate"));
		ticket.setPrice(rs.getInt("price"));
		ticket.setDeadline(rs.getDate("deadline"));
		
		return ticket;
	}
}